package com.recsmile.sgs.entity;


/**
 * Created by Administrator on 2016/8/26.
 */
public class Card {

    public void read(org.dom4j.Element element) {
        id = Integer.parseInt(element.elementText("id"));
        suit = Suit.valueOf(element.elementText("suit"));
        color =( suit == Suit.DIAMOND || suit == Suit.HEART )? Color.RED : Color.BLACK;
        number = element.elementText("number");
        image = element.elementText("image");
        real = Boolean.valueOf(element.elementText("real"));
        cardType = CardType.valueOf(element.elementText("type"));
    }

    public static enum Suit {
        DIAMOND, CLUB, HEART, SPADE
    }

    public static enum Color {
        RED, BLACK, COLORLESS
    }

    public static enum CardType {
        BASIC, SPECIAL, EQUIPMENT
    }
    public static enum Element{
        NORMAL, FIRE, THUNDER;
    }

    protected Suit suit;
    protected Color color;
    protected String number;
    protected int id;
    protected String image;
    protected boolean real;
    protected CardType cardType;

    public Suit getSuit() {
        return suit;
    }

    public void setSuit(Suit suit) {
        this.suit = suit;
    }

    public Color getColor() {
        return color;
    }

    public void setColor(Color color) {
        this.color = color;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public boolean isReal() {
        return real;
    }

    public void setReal(boolean real) {
        this.real = real;
    }

    public CardType getCardType() {
        return cardType;
    }

    public void setCardType(CardType cardType) {
        this.cardType = cardType;
    }

    public Card cloneMe(){
        return clone(new Card());
    }

    protected Card clone(Card c){
        c.real = real;
        c.image = image;
        c.number = number;
        c.color = color;
        c.id = id;
        c.suit = suit;
        c.cardType = cardType;
        return c;
    }

}
